<template>
  <ul>
    <li
        v-for="(item, index) in girls"
        :key="index"
        @click="selectGirl(index)"
    >
      {{index}}. <button>{{ item }}</button>
    </li>
  </ul>
  <div>You have selected: {{ selected }}</div>
</template>

<script lang="ts">
import {defineComponent, ref} from 'vue'

export default defineComponent({
  name: "TestSetupRef",
  setup() {
    const girls = ref(['Dajiao', 'Liuying', 'Xiaohong'])
    const selected = ref('')
    const selectGirl = (index: number) => {
      selected.value = girls.value[index]
    }
    return {
      girls,
      selected,
      selectGirl,
    }
  }
})
</script>

<style scoped>

</style>
